const { BrowserWindow } = require("electron");

class AppWindow extends BrowserWindow {
    constructor(config, urlLocation) {
        const basicConfig = {
            width: 800,
            height: 600,
            webPreferences: {
                nodeIntegration: true,
                contextIsolation: false,
                enableRemoteModule: true,
            },
            show: false,
            backgroundColor: "#ededed",
        };
        // 最终配置
        const finalConfig = { ...basicConfig, ...config };
        // 传给父类
        super(finalConfig);
        this.loadURL(urlLocation);
        this.once("ready-to-show", () => {
            this.show();
        });
    }
}

module.exports = AppWindow;
